package fr.umlv.escapeir.gesture;


public class Point implements Mask{

	@Override
	public boolean isValid(Gesture g) {
		int nbElement = g.size();
		
		if(nbElement > 0 && nbElement <=2) {
			
			if(nbElement == 1) {
				g.setGestureValid(Masks.POINT, Direction.UNDEFINED);
				return true;
			}
			else {
				int xHead = g.getX(0);
				int xTail = g.getX(1);
				int yHead = g.getY(0);
				int yTail = g.getY(1);
				
				if(xHead == xTail && yHead == yTail) {
					g.setGestureValid(Masks.POINT, Direction.UNDEFINED);
					return true;
				}
			}
		}
		return false;
	}
}
